package com.gzdh.device.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.gzdh.device.system.entity.SysPermission;
import com.gzdh.device.system.mapper.SysPermissionMapper;
import com.gzdh.device.system.service.SysPermissionService;
import com.gzdh.device.system.vo.PermissionVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, SysPermission>
        implements SysPermissionService {

    /**
     * 插入菜单权限
     *
     * @param permissionVO
     */
    @Override
    public void insertPermission(PermissionVO permissionVO) {
        SysPermission sysPermission = new SysPermission();
        sysPermission.setName(permissionVO.getName());
        sysPermission.setSort(Integer.parseInt(permissionVO.getSort()));
        sysPermission.setType(Integer.parseInt(permissionVO.getType()));
        sysPermission.setIcon(permissionVO.getIcon());
        sysPermission.setParentId(permissionVO.getParentId());
        this.save(sysPermission);
    }
}
